﻿@using CoralNode.MvcClient.Helper
@using Coralcode.Base.Entity
@model CoralNode.Core.Entity.SearchQuerys.Node.NodeSearchQuery
@{
    ViewData["curr"] = "recycled";
}
@Html.IncludePage("CoralAdmin/Node", "_Left")
<!--content-->
<div id="pbody">
    <div class="extra">
        <div class="pbody_top">
            <span class="ico ico_setting_system"></span><span class="t t_c">内容管理&nbsp;&nbsp;/&nbsp;&nbsp;<b
                class=" t_small f_no">回收站</b></span>
        </div>
        <div id="main">
            <div class="line_solid clearfix">
                @Html.IncludePage("CoralAdmin/Node", "_Side", new { url = "/m/node/listdraft?categoryId=" })
                <div class="js_tabcnt ml_12">
                    <div class="">
                        <div class="tablelist_style1" data-js="tabellist_style1">
                            <div class="funsearch p_1 pl_2 pr_2">
                                @if (@ViewBag.NodeList.TotalItems > 0) {
                                    <a class="btn_5 f_r ml_2 js-clear" href="/m/node/ClearDraft">清 空</a>
                                }
                                <div class="f_r">
                                    <form method="" action="">
                                        <span class="t_des f_l pt_0-5">内容名称：</span>
                                        <label class="search f_l">
                                            @Html.TextBoxFor(m => m.Title, new { @class = "text w20", @msg = "请输入关键字" })
                                            @Html.AntiForgeryToken()
                                            <input type="submit" value="" class="submit" /></label>
                                    </form>
                                </div>
                            </div>
                            <table cellpadding="0" cellspacing="0" class="mt_3-5">
                                <tr class="exclude">
                                    <th width="60">选择</th>
                                    <th width="100" align="left">ID</th>
                                    <th align="left">名称</th>
                                    <th width="60">状态</th>
                                    <th width="140">操作</th>
                                </tr>
                                @foreach (var item in @ViewBag.NodeList.Items) {
                                    <tr>
                                        <td>
                                            <label class="checkbox_own">
                                                <input type="checkbox" value="@item.Id"/></label></td>
                                        <td class="td_left">@item.Id</td>
                                        <td class="td_left"><a href="/m/node/editNode/@item.Id">@item.Title</a></td>
                                        <td><a href="#" class="ico ico_moveup mr_2 f_no  btn"></a><a href="#" class="ico ico_movedown btn">
                                        </a>
                                        </td>
                                        <td>
                                            <div class="fun">
                                                <a  class="js_delete" href="/m/Node/RestoreNodeByDraft/@item.Id">还原</a><a href="/m/Node/DeleteNodeByDraft/@item.Id" class="js_delete">永久删除</a>
                                            </div>
                                        </td>
                                    </tr>
                                }
                            </table>
                            <div class="global_fun ">
                                <label class="checkbox_own gloabal_select">
                                    <input type="checkbox" /></label>
                                <input type="button" class="btn_4 btn invert" value="反选" /><input type="button" class="btn_4 btn reset"
                                    value="重置" />
                                <a href="/m/node/DelBatchNodeByDraft" class="js_delete">删除</a>
                                <a href="/m/node/RestoreBatchNodeByDraft" class="js_delete">还原</a>
                            </div>
                        </div>
                    </div>
                </div>
                <div id="pager">
                    <div class="info_pg">共@(ViewBag.NodeList.TotalItems)条</div>
                    <div class="list_pg">
                        <a href="/m/node/listNode?@ViewBag.queryString&p=1" class="first">首页</a>
                        @if (@ViewBag.NodeList.HasPreviousPage && @ViewBag.NodeList.TotalItems > 0) {
                            <a href="/m/node/listNode?@ViewBag.queryString&p=@ViewBag.NodeList.PreviousPageIndex" class="prev">
                                上一页</a>
                        } else {
                            <a class="prev none">上一页</a>
                        }
                        @foreach (var i in @ViewBag.NodeList.PageArray) {
                            if (@i == @ViewBag.NodeList.CurrentPageIndex) {
                            <a class="current">@i</a>
                            } else if (@i == 0) {
                            <a class="more">…</a>
                            } else {
                            <a href="/m/node/listNode?@ViewBag.queryString&p=@i" href="#">@i</a>
                            }
                        }
                        @if (@ViewBag.NodeList.HasNextPage && @ViewBag.NodeList.TotalItems > 0) {
                            <a class="next" href="/m/node/listNode?@ViewBag.queryString&p=@ViewBag.NodeList.NextPageIndex">
                                下一页</a>
                        } else {
                            <a class="next none">下一页</a>
                        }
                        <a class="last" href="/m/node/listNode?@ViewBag.queryString&p=@ViewBag.NodeList.TotalPages">
                            尾页</a>
                        <!-- <span class="msg">跳转</span>
                        <input class="text" type="text" value="">
                        <span class="msg">页</span>-->
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        $(document).ready(function () {
            $('.js-clear').click(function (e) {
                e.preventDefault();
                var href = $(this).attr("href");
                $.confirm("您确定要清空回收站吗？(总共有@(ViewBag.NodeList.TotalItems)个内容)", function () {
                    $.post(href, function (data) {
                        if (data) {
                            location.reload();
                        }
                    });
                });
                return false;
            });
        });
    </script>
